<script setup lang="ts">
import { useRouter } from 'vue-router'

const router = useRouter()

// 返回首页
const goToHome = () => {
  router.push('/')
}

// 返回上一页
const goBack = () => {
  router.back()
}
</script>

<template>
  <div class="forbidden">
    <div class="forbidden-container">
      <div class="error-code">403</div>
      <h1>无权限访问</h1>
      <p>抱歉，您没有权限访问此页面</p>
      <div class="error-actions">
        <button class="btn-back" @click="goBack">返回上一页</button>
        <button class="btn-home" @click="goToHome">返回首页</button>
      </div>
      <div class="error-details">
        <h2>可能的原因：</h2>
        <ul>
          <li>您的账号没有访问此页面的权限</li>
          <li>您的登录会话已过期</li>
          <li>您需要更高的权限级别</li>
        </ul>
        <p class="contact-support">
          如果您认为这是一个错误，请联系
          <a href="mailto:support@example.com">技术支持</a>
        </p>
      </div>
    </div>
  </div>
</template>

<style scoped>
.forbidden {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  padding: 2rem;
}

.forbidden-container {
  text-align: center;
  max-width: 500px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  padding: 3rem 2rem;
}

.error-code {
  font-size: 8rem;
  font-weight: 700;
  color: #dc3545;
  line-height: 1;
  margin-bottom: 1rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

h1 {
  font-size: 2rem;
  color: #333;
  margin-bottom: 1rem;
}

p {
  color: #666;
  margin-bottom: 2rem;
  font-size: 1.1rem;
}

.error-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2rem;
}

.btn-back,
.btn-home {
  padding: 0.75rem 2rem;
  border: none;
  border-radius: 5px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-back {
  background: #6c757d;
  color: white;
}

.btn-back:hover {
  background: #5a6268;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-home {
  background: #007bff;
  color: white;
}

.btn-home:hover {
  background: #0056b3;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.error-details {
  text-align: left;
  border-top: 1px solid #eee;
  padding-top: 2rem;
}

.error-details h2 {
  font-size: 1.25rem;
  color: #333;
  margin-bottom: 1rem;
}

.error-details ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
}

.error-details li {
  color: #666;
  margin-bottom: 0.5rem;
  padding-left: 1.5rem;
  position: relative;
}

.error-details li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: #dc3545;
}

.contact-support {
  margin: 0;
  font-size: 0.875rem;
}

.contact-support a {
  color: #007bff;
  text-decoration: none;
}

.contact-support a:hover {
  text-decoration: underline;
}

/* 响应式设计 */
@media (max-width: 480px) {
  .forbidden-container {
    padding: 2rem 1.5rem;
  }

  .error-code {
    font-size: 6rem;
  }

  h1 {
    font-size: 1.75rem;
  }

  p {
    font-size: 1rem;
  }

  .error-actions {
    flex-direction: column;
  }

  .btn-back,
  .btn-home {
    width: 100%;
  }
}
</style> 